package com.lordjoe.collectiveintelligence;

/**
 * com.lordjoe.collectiveintelligence.Flight
 *
 * @author Steve Lewis
 * @date Mar 24, 2009
 */
public class Flight
{
    public static Flight[] EMPTY_ARRAY = {};
    public static Class THIS_CLASS = Flight.class;

    private final String m_StartAirport;
    private final String m_EndAirport;
    private final int m_StartTime;
    private final int m_ArriveTime;
    private final int m_Cost;
    private int m_DailyToIndex;
    private int m_DailyFromIndex;

    public Flight(String[] s)
    {
        int index = 0;
        m_StartAirport = s[index++];
        m_EndAirport = s[index++];
        m_StartTime = OptimizationUtilities.parseTime(s[index++]);
        m_ArriveTime = OptimizationUtilities.parseTime(s[index++]);
        m_Cost = Integer.parseInt(s[index++]);
       m_DailyToIndex = 0;
    }

    public Flight(String s)
    {
        this(s.split(","));
    }

    @Override
    public String toString()
    {
       StringBuilder sb = new StringBuilder();
        sb.append(getStartAirport());
        sb.append("=>");
        sb.append(getEndAirport());
        sb.append(" ");

        sb.append(OptimizationUtilities.stringTime(getStartTime()));
        sb.append("-");
        sb.append(OptimizationUtilities.stringTime(getArriveTime()));
        sb.append(" $");
        sb.append(Integer.toString(getCost()));

       return sb.toString();
    }
    public String getStartAirport()
    {
        return m_StartAirport;
    }

    public String getEndAirport()
    {
        return m_EndAirport;
    }

    public int getStartTime()
    {
        return m_StartTime;
    }

    public int getArriveTime()
    {
        return m_ArriveTime;
    }

    public int getCost()
    {
        return m_Cost;
    }

    public int getDailyToIndex()
    {
        return m_DailyToIndex;
    }

    public void setDailyToIndex(int pDailyToIndex)
    {
        m_DailyToIndex = pDailyToIndex;
    }

    public int getDailyFromIndex()
    {
        return m_DailyFromIndex;
    }

    public void setDailyFromIndex(int pDailyFromIndex)
    {
        m_DailyFromIndex = pDailyFromIndex;
    }
}
